import axios from 'axios'

import { Indicator } from 'mint-ui';

export default {
	
	common:{
		method:'GET',
		params: {}
	},
	$axios( options={} ){
		
		options.method = options.method || this.common.method;
		options.params = options.params || this.common.params;

		//请求前==>加载Indicator
		Indicator.open('加载中...');
		
		return axios(options).then(v=>{
			let data = v.data.data;
			return new Promise((res,rej) => {
					
				if( !v ){
					return rej();
				}
				//结束==》关闭Indicator
				setTimeout(()=>{
					Indicator.close();
				},500)
					
				res( data );
				
			})
			
		})
		
		
	}
	
}

